package com.dd.keel.core.framework.server;

import org.apache.mina.core.session.IoSession;

import com.dd.keel.core.framework.CPacket;



/**
 * 请求/应答对象
 * @author Kevin.XU
 *
 */
public class ServerTaskObj {

	private IoSession session;  /**连接**/
	private Object msgObj;      /**请求消息**/
	
	public ServerTaskObj(){}
	
	public ServerTaskObj(IoSession session,Object msgObj)
	{
		this.session = session;
		this.msgObj = msgObj;
	}
	
	public IoSession getSession() {
		return session;
	}
	public void setSession(IoSession session) {
		this.session = session;
	}
	public Object getMsgObj() {
		return msgObj;
	}
	public void setMsgObj(Object msgObj) {
		this.msgObj = msgObj;
	}

	public String getSequence()
	{
		return ((CPacket)msgObj).packetSequence();
	}
	
	/**
	 * 用于区别不同客户端的序列号<p>
	 * 返回形如: /10.1.32.31:58776:1234
	 * @return
	 */
	public String getSequenceWithRemoteAddr()
	{
		return session.getServiceAddress() +":"+ ((CPacket)msgObj).packetSequence();
	}
	
}
